package com.ld.poetry.aigc.codegeex.gclu.unittest;

import com.ld.poetry.aigc.codegeex.gclu.unittest.EmployeeService;

import org.junit.Assert;
import org.junit.Test;


public class EmployeeServiceTest {

    @Test
    public void testAddEmployee() {
        EmployeeService service = new EmployeeService();
        EmployeeService.Employee employee1 = new EmployeeService.Employee("Alice", "HR");
        EmployeeService.Employee employee2 = new EmployeeService.Employee("Bob", "IT");
        service.addEmployee(employee1);
        service.addEmployee(employee2);
        Assert.assertEquals(2, service.employees.size());
    }

    @Test
    public void testGetAllEmployees() {
        EmployeeService service = new EmployeeService();
        EmployeeService.Employee employee1 = new EmployeeService.Employee("Alice", "HR");
        EmployeeService.Employee employee2 = new EmployeeService.Employee("Bob", "IT");
        service.addEmployee(employee1);
        service.addEmployee(employee2);
        Assert.assertEquals(2, service.getAllEmployees().size());
    }

    @Test
    public void testGetEmployeesByDepartment() {
        EmployeeService service = new EmployeeService();
        EmployeeService.Employee employee1 = new EmployeeService.Employee("Alice", "HR");
        EmployeeService.Employee employee2 = new EmployeeService.Employee("Bob", "IT");
        EmployeeService.Employee employee3 = new EmployeeService.Employee("Charlie", "HR");
        service.addEmployee(employee1);
        service.addEmployee(employee2);
        service.addEmployee(employee3);
        Assert.assertEquals(2, service.getEmployeesByDepartment("HR").size());
    }

    @Test
    public void testRemoveEmployee() {
        EmployeeService service = new EmployeeService();
        EmployeeService.Employee employee1 = new EmployeeService.Employee("Alice", "HR");
        EmployeeService.Employee employee2 = new EmployeeService.Employee("Bob", "IT");
        service.addEmployee(employee1);
        service.addEmployee(employee2);
        service.removeEmployee(employee1);
        Assert.assertEquals(1, service.getAllEmployees().size());
    }
}